//
//  FoundTableViewController.m
//  Hero
//
//  Created by lanou3g on 16/5/5.
//  Copyright © 2016年 刘永庆. All rights reserved.
//

#import "FoundTableViewController.h"
#import "FoundHeardView.h"
#import "HeroViewController.h"
#import "InsetentViewController.h"
#import "GoodViewController.h"
#import "BiZhiViewController.h"
#import "VoidTableViewController.h"
@interface FoundTableViewController ()
@property (nonatomic, strong) NSArray *dataArray;
@property (nonatomic, strong) FoundHeardView *myView;
@end

@implementation FoundTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.backgroundColor = [UIColor blueColor];
    self.dataArray = [NSMutableArray new];
    self.tableView.separatorStyle = 0;
    self.dataArray = @[@"英雄资料",@"物品资料",@"兴趣部落",@"英雄时刻",@"壁纸"];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"foundCell"];
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150)];
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 150)];
    imageView.image = [UIImage imageNamed:@"战队图标.png"];
    [view addSubview:imageView];
    self.tableView.tableHeaderView = view;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.dataArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"foundCell"];
    cell.textLabel.text = self.dataArray[indexPath.row];
  
    
    cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.png",indexPath.row + 1]];
    cell.textLabel.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:24];
    
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        HeroViewController *heroVC = [[HeroViewController alloc]init];
        [self.navigationController pushViewController:heroVC animated:YES];
    }
    if (indexPath.row == 1) {
        GoodViewController *gooVc = [GoodViewController new];
        [self.navigationController pushViewController:gooVc animated:YES];
    }
    if (indexPath.row == 2) {
        InsetentViewController *inst = [InsetentViewController new];
        [self.navigationController pushViewController:inst animated:YES];
    }
    if (indexPath.row == 4) {
        BiZhiViewController *bizhi = [BiZhiViewController new];
        [self.navigationController pushViewController:bizhi animated:YES];
    }
    if (indexPath.row == 3) {
        VoidTableViewController *voVc = [VoidTableViewController new];
        [self.navigationController pushViewController:voVc animated:YES];
    }
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
